{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% if Plugins|length > 0 %}
    <div class="table_list plugin-table">
        <div class="table-responsive with-border">
            <table class="table table-hover table-condensed">
                <thead>
                <tr>
                    <th>プラグイン</th>
                    <th>バージョン</th>
                    <th>コード</th>
                    <th>アップデート</th>
                    <th>設定</th>
                </tr>
                </thead>
                <tbody>
                {% for Plugin in Plugins %}
                    {% set form = plugin_forms[Plugin.id] %}
                    <form id="{{ form.vars.name }}" name="{{ form.vars.name }}" method="post" action="" {{ form_enctype(form) }}>
                        <tr class="{% if Plugin.enable == 0 %}active{% endif %}">
                            <td class="tp">
                                <strong>{{ Plugin.name }}</strong>{% if Plugin.enable == 0 %}<span class="text-danger"> (停止中)</span>{% endif %}<br>
                                {% if Plugin.enable == 1 %}
                                    <a href="{{ url('admin_store_plugin_disable', { id : Plugin.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-confirm="false">
                                        無効にする
                                    </a>
                                {% else %}
                                    <a href="{{ url('admin_store_plugin_enable', { id : Plugin.id }) }}" {{ csrf_token_for_anchor() }} data-method="put" data-confirm="false">
                                        有効にする
                                    </a>
                                {% endif %}
                                /
                                <a href="{{ url('admin_store_plugin_uninstall', { id : Plugin.id }) }}" {{ csrf_token_for_anchor() }} data-method="delete" data-message="このプラグインを削除してもよろしいですか？">
                                    削除
                                </a>
                            </td>
                            <td class="tv text-center">{{ Plugin.version }}</td>
                            <td class="tc"><p>{{ Plugin.code }}</p>
                                {% if attribute(app.config[Plugin.code].const, 'readme') is defined %}
                                    <a href="#" class="view_readme" data-toggle="modal" data-target="#readmeModal" data-name="{{ Plugin.name }}" data-readme="{{ attribute(app.config[Plugin.code].const, 'readme')  }}">詳細を表示</a>
                                {% endif %}
                            </td>
                            <td class="tu">
                            {% if Plugin.source == 0 %}
                                {{ form_widget(form._token) }}
                                {{ form_widget(form.plugin_id) }}
                                {{ form_widget(form.plugin_archive, {'attr': {'accept': 'application/zip,application/x-tar,application/x-gzip'}}) }}
                                {{ form_errors(form.plugin_archive) }}
                                <p></p>
                                <a class="btn btn-primary btn-xs" href="#" onclick="changeActionSubmit('{{ url('admin_store_plugin_update', { id : Plugin.id }) }}', '{{ form.vars.name }}');">
                                    アップロード
                                </a>
                            {% else %}
                                {% if Plugin.updateStatus == 3 %}
                                    <p>新バージョンのプラグインが利用可能です。
                                        <a class="btn btn-default btn-xs" href="{{ url('admin_store_plugin_upgrade', {'action': 'update', 'id': Plugin.source, 'version': Plugin.version}) }}">今すぐ更新</a>
                                    </p>
                                    <ul class="plugin-meta dl-horizontal">
                                        <li class="plugin-version">プラグインバージョン : {{ Plugin.newVersion }}</li>
                                        <li class="plugin-version">EC-CUBE対応バージョン : {{ Plugin.eccubeVersionAsString }}</li>
                                        <li class="plugin-update">更新日 : {{ Plugin.lastUpdateDate|time_ago }}</li>
                                    </ul>
                                {% else %}
                                    <p>アップデート対象プラグインはありません。</p>
                                {% endif %}
                                <p><a href="{{ Plugin.productUrl }}" target="_blank">詳細情報</a></p>
                            {% endif %}
                            </td>
                            <td class="ta text-center">
                                {% if configPages[Plugin.code] is defined %}
                                   <a href='{{configPages[Plugin.code]}}'>設定</a>
                                {% endif %}
                            </td>
                        </tr>
                    </form>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% else %}
    <div class="text-danger">
        インストールされているプラグインはありません。
    </div>
{% endif %}
